package bbs.entity.enums;

import bbs.entity.constants.Constants;

public enum FileUploadTypeEnum {

    ARTICLE_COVER(Constants.IMAGE_SUFFIX, "文章封面"),
    ARTICLE_ATTACHMENT(new String[]{".zip",".ZIP",".rar",".RAR"}, "文章附件"),
    COMMENT_IMAGE(Constants.IMAGE_SUFFIX, "评论图片"),
    AVATAR(Constants.IMAGE_SUFFIX, "用户头像");


    private String[] suffixArray;
    private String desc;

    private FileUploadTypeEnum(String[] suffixArray, String desc) {
        this.suffixArray = suffixArray;
        this.desc = desc;
    }
    public String[] getSuffixArray() {
        return suffixArray;
    }
    public String getDesc() {
        return desc;
    }
    public static FileUploadTypeEnum getByDesc(String desc) {
        for (FileUploadTypeEnum e : FileUploadTypeEnum.values()) {
            if (e.getDesc().equals(desc)) {
                return e;
            }
        }
        return null;
    }
}
